import os

import pandas as pd
from PySide6.QtCore import QFileInfo



# final_name = os.path.join( fileInfo.path, )
# print(final_name)
csv = pd.read_csv("/Users/a12345/Downloads/files/MergedFile.csv", usecols=["Date/Time", "MSTC"])
#
# grouped_data = csv.groupby("MSTC")
# print(len(grouped_data))
# csv.index = csv.index
csv = csv.ffill(axis=0)
# print(len(csv.index))

window_group=csv.groupby((csv['MSTC'].shift() != csv['MSTC']).cumsum())
for k, v in window_group:
    print(k)
    print(v)
# print(df)
# data = pd.read_csv("/Users/a12345/Downloads/files/MergedFilesmall.csv", nrows=100, usecols=[0,1,2,3,4,5])

# # data["MSTC"] = data["MSTC"].ffill(axis=0)
# new_i = data.columns.get_loc("#KEY / 100")
# print(new_i)
# data.insert(new_i, "Source", "abc")
#
# print(data)

# test_dict = {'id':[1,2,3,4,5,6],'name':['Alice','Bob','Cindy','Eric','Helen','Grace '],
#              'math':[90,89,99,78,97,93],'english':[89,94,80,94,94,90],
#              'aa':['aa','aa','aa','aa','aa','aa']}
#
# test_dict_df = pd.DataFrame(test_dict)
# test_dict_df = test_dict_df.groupby(['name', 'aa']).mean()
# print(test_dict_df)